package com.woniuxy.rabbitMq.listner;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Date;

@Component
public class TopicListnerA {
    @RabbitListener(queues = "topicQueueA")
    public void onMeg(String msg, Channel channel, Message message) throws IOException {
        System.out.println("TopicListnerA 接受到消息："+msg+new Date());
        //收到提交
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }
}
